import java.io.*;
import java.util.*;

import org.testng.annotations.Test;

import ru.ksu.ktk.diploma.sdi.analyzer.contingency.ContingencyResolver;
import ru.ksu.ktk.diploma.sdi.analyzer.contingency.NominalData;

public class ContingencyResolverTestCase {
    private static final String FIRST_VECTOR_PATH = "C://temp//emku//desc//emku-name-tn-superfacets.txt";
    private static final String SECOND_VECTOR_PATH = "C://temp//emku//desc//emku-technique-nm-filtered.txt";
    private static final String NOMINAL_DATA_PATH = "C://temp//emku//desc//emku-desc-name-technique-upcasted.txt";

    @Test
    public void testComputeCoeff() throws IOException {
        List<String> firstVector = FileUtil.readValues(FIRST_VECTOR_PATH);

        List<String> secondVector = FileUtil.readValues(SECOND_VECTOR_PATH);

        List<NominalData> nominalDataList = FileUtil.readNominalData(NOMINAL_DATA_PATH);
        ContingencyResolver resolver = new ContingencyResolver();
        int[][] matrix = resolver.initContingencyMatrix(firstVector, secondVector, nominalDataList);
        float coeff = resolver.computeSquaredContingencyCoefficient(true);
        for (int[] row : matrix){
            System.out.println(Arrays.toString(row));
        }
        System.out.println(coeff);
    }

}
